package com.bw.permission.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bw.permission.entity.Area;
import com.bw.permission.mapper.AreaMapper;
import com.bw.permission.service.IAreaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhanggm
 * @since 2021-08-18
 */
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService {


    /**
     * 根据Pid，查询城市列表
     * @param pid
     * @return
     */
    public List<Area> getListByPid(Integer pid) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("pid", pid);
        queryWrapper.select("id", "name", "pid");
        List<Area> areas = list(queryWrapper);
        return areas;
    }
}
